+Wed Oct 31 18:23:47 2001 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtkoptionmenu.c (gtk_option_menu_detacher):
+ Add a "menu" property and notify on it. (#62798,
+ Padraig O'Briain)
+
+ * gtk/gtkselection.[ch] gtk/{gtkentry.c, gtkfilesel.c,
+ gtkoldeditable.c, gtktextbuffer.c, gtktextview.c}:
+ Fix set_text to take a gchar, not a guchar, and to have
+ a len argument.
+
Wed Oct 31 15:31:13 2001 Manish Singh <yosh@gimp.org>
* gtk/gtkstock.c: fix typo to make it compile
+Wed Oct 31 18:23:47 2001 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtkoptionmenu.c (gtk_option_menu_detacher):
+ Add a "menu" property and notify on it. (#62798,
+ Padraig O'Briain)
+
+ * gtk/gtkselection.[ch] gtk/{gtkentry.c, gtkfilesel.c,
+ gtkoldeditable.c, gtktextbuffer.c, gtktextview.c}:
+ Fix set_text to take a gchar, not a guchar, and to have
+ a len argument.
+
Wed Oct 31 15:31:13 2001 Manish Singh <yosh@gimp.org>
* gtk/gtkstock.c: fix typo to make it compile
+Wed Oct 31 18:23:47 2001 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtkoptionmenu.c (gtk_option_menu_detacher):
+ Add a "menu" property and notify on it. (#62798,
+ Padraig O'Briain)
+
+ * gtk/gtkselection.[ch] gtk/{gtkentry.c, gtkfilesel.c,
+ gtkoldeditable.c, gtktextbuffer.c, gtktextview.c}:
+ Fix set_text to take a gchar, not a guchar, and to have
+ a len argument.
+
Wed Oct 31 15:31:13 2001 Manish Singh <yosh@gimp.org>
* gtk/gtkstock.c: fix typo to make it compile
+Wed Oct 31 18:23:47 2001 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtkoptionmenu.c (gtk_option_menu_detacher):
+ Add a "menu" property and notify on it. (#62798,
+ Padraig O'Briain)
+
+ * gtk/gtkselection.[ch] gtk/{gtkentry.c, gtkfilesel.c,
+ gtkoldeditable.c, gtktextbuffer.c, gtktextview.c}:
+ Fix set_text to take a gchar, not a guchar, and to have
+ a len argument.
+
Wed Oct 31 15:31:13 2001 Manish Singh <yosh@gimp.org>
* gtk/gtkstock.c: fix typo to make it compile
+Wed Oct 31 18:23:47 2001 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtkoptionmenu.c (gtk_option_menu_detacher):
+ Add a "menu" property and notify on it. (#62798,
+ Padraig O'Briain)
+
+ * gtk/gtkselection.[ch] gtk/{gtkentry.c, gtkfilesel.c,
+ gtkoldeditable.c, gtktextbuffer.c, gtktextview.c}:
+ Fix set_text to take a gchar, not a guchar, and to have
+ a len argument.
+
Wed Oct 31 15:31:13 2001 Manish Singh <yosh@gimp.org>
* gtk/gtkstock.c: fix typo to make it compile
+Wed Oct 31 18:23:47 2001 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtkoptionmenu.c (gtk_option_menu_detacher):
+ Add a "menu" property and notify on it. (#62798,
+ Padraig O'Briain)
+
+ * gtk/gtkselection.[ch] gtk/{gtkentry.c, gtkfilesel.c,
+ gtkoldeditable.c, gtktextbuffer.c, gtktextview.c}:
+ Fix set_text to take a gchar, not a guchar, and to have
+ a len argument.
+
Wed Oct 31 15:31:13 2001 Manish Singh <yosh@gimp.org>
* gtk/gtkstock.c: fix typo to make it compile
+Wed Oct 31 18:23:47 2001 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtkoptionmenu.c (gtk_option_menu_detacher):
+ Add a "menu" property and notify on it. (#62798,
+ Padraig O'Briain)
+
+ * gtk/gtkselection.[ch] gtk/{gtkentry.c, gtkfilesel.c,
+ gtkoldeditable.c, gtktextbuffer.c, gtktextview.c}:
+ Fix set_text to take a gchar, not a guchar, and to have
+ a len argument.
+
Wed Oct 31 15:31:13 2001 Manish Singh <yosh@gimp.org>
* gtk/gtkstock.c: fix typo to make it compile
guint info,
gpointer data)
{
- gtk_selection_data_set_text (selection_data, data);
+ gtk_selection_data_set_text (selection_data, data, -1);
}
static void
if (gtk_editable_get_selection_bounds (GTK_EDITABLE (entry), &start, &end))
{
gchar *str = gtk_entry_get_public_chars (entry, start, end);
- gtk_selection_data_set_text (selection_data, str);
+ gtk_selection_data_set_text (selection_data, str, -1);
g_free (str);
}
}
{
gchar *str = gtk_editable_get_chars (editable, sel_start, sel_end);
- gtk_selection_data_set_text (selection_data, str);
+ gtk_selection_data_set_text (selection_data, str, -1);
g_free (str);
}
else
{
g_print ("Setting text: '%s'\n", file);
- gtk_selection_data_set_text (selection_data, file);
+ gtk_selection_data_set_text (selection_data, file, -1);
}
}
}
gpointer user_data_or_owner)
{
GtkLabel *label;
- gchar *str;
label = GTK_LABEL (user_data_or_owner);
if (start > len)
start = len;
- str = g_strndup (label->text + start,
- end - start);
-
- gtk_selection_data_set_text (selection_data,
- str);
-
- g_free (str);
+ gtk_selection_data_set_text (selection_data,
+ label->text + start,
+ end - start);
}
}
if (str)
{
- gtk_selection_data_set_text (selection_data, str);
+ gtk_selection_data_set_text (selection_data, str, -1);
g_free (str);
}
}
static void gtk_option_menu_class_init (GtkOptionMenuClass *klass);
static void gtk_option_menu_init (GtkOptionMenu *option_menu);
static void gtk_option_menu_destroy (GtkObject *object);
+static void gtk_option_menu_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec);
+static void gtk_option_menu_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec);
static void gtk_option_menu_size_request (GtkWidget *widget,
GtkRequisition *requisition);
static void gtk_option_menu_size_allocate (GtkWidget *widget,
LAST_SIGNAL
};
+enum
+{
+ PROP_0,
+ PROP_MENU,
+ LAST_PROP
+};
+
static GtkButtonClass *parent_class = NULL;
static guint signals[LAST_SIGNAL] = { 0 };
static void
gtk_option_menu_class_init (GtkOptionMenuClass *class)
{
+ GObjectClass *gobject_class;
GtkObjectClass *object_class;
GtkWidgetClass *widget_class;
GtkButtonClass *button_class;
GtkContainerClass *container_class;
+ gobject_class = (GObjectClass*) class;
object_class = (GtkObjectClass*) class;
widget_class = (GtkWidgetClass*) class;
button_class = (GtkButtonClass*) class;
NULL, NULL,
gtk_marshal_VOID__VOID,
G_TYPE_NONE, 0);
-
+
+ gobject_class->set_property = gtk_option_menu_set_property;
+ gobject_class->get_property = gtk_option_menu_get_property;
object_class->destroy = gtk_option_menu_destroy;
widget_class->size_request = gtk_option_menu_size_request;
container_class->child_type = gtk_option_menu_child_type;
+ g_object_class_install_property (gobject_class,
+ PROP_MENU,
+ g_param_spec_object ("menu",
+ _("Menu"),
+ _("The menu of options"),
+ GTK_TYPE_MENU,
+ G_PARAM_READABLE | G_PARAM_WRITABLE));
+
gtk_widget_class_install_style_property (widget_class,
g_param_spec_boxed ("indicator_size",
_("Indicator Size"),
option_menu);
option_menu->menu = NULL;
+ g_object_notify (G_OBJECT (option_menu), "menu");
}
void
gtk_widget_queue_resize (GTK_WIDGET (option_menu));
gtk_option_menu_update_contents (option_menu);
+
+ g_object_notify (G_OBJECT (option_menu), "menu");
}
}
return -1;
}
+static void
+gtk_option_menu_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ GtkOptionMenu *option_menu = GTK_OPTION_MENU (object);
+
+ switch (prop_id)
+ {
+ case PROP_MENU:
+ gtk_option_menu_set_menu (option_menu, g_value_get_object (value));
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+gtk_option_menu_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ GtkOptionMenu *option_menu = GTK_OPTION_MENU (object);
+
+ switch (prop_id)
+ {
+ case PROP_MENU:
+ g_value_set_object (value, option_menu->menu);
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
static void
gtk_option_menu_destroy (GtkObject *object)
{
* gtk_selection_data_set_text:
* @selection_data: a #GtkSelectionData
* @str: a UTF-8 string
+ * @len: the length of @str, or -1 if @str is nul-terminated.
*
* Sets the contents of the selection from a UTF-8 encoded string.
* The string is converted to the form determined by
**/
gboolean
gtk_selection_data_set_text (GtkSelectionData *selection_data,
- const guchar *str)
+ const gchar *str,
+ gint len)
{
+ gboolean result = FALSE;
+
+ if (len < 0)
+ len = strlen (str);
+
init_atoms ();
if (selection_data->target == utf8_atom)
{
gtk_selection_data_set (selection_data,
utf8_atom,
- 8, (guchar *)str, strlen (str));
- return TRUE;
+ 8, (guchar *)str, len);
+ result = TRUE;
}
else if (selection_data->target == GDK_TARGET_STRING)
{
- gchar *latin1 = gdk_utf8_to_string_target (str);
+ gchar *tmp = g_strndup (str, len);
+ gchar *latin1 = gdk_utf8_to_string_target (tmp);
+ g_free (tmp);
if (latin1)
{
gtk_selection_data_set (selection_data,
GDK_SELECTION_TYPE_STRING,
8, latin1, strlen (latin1));
- g_free(latin1);
+ g_free (latin1);
- return TRUE;
+ result = TRUE;
}
}
else if (selection_data->target == ctext_atom ||
selection_data->target == text_atom)
{
+ gchar *tmp;
guchar *text;
GdkAtom encoding;
gint format;
gint new_length;
-
- if (gdk_utf8_to_compound_text (str, &encoding, &format, &text, &new_length))
+
+ tmp = g_strndup (str, len);
+ if (gdk_utf8_to_compound_text (tmp, &encoding, &format, &text, &new_length))
{
gtk_selection_data_set (selection_data, encoding, format, text, new_length);
gdk_free_compound_text (text);
-
- return TRUE;
+
+ result = TRUE;
}
+
+ g_free (tmp);
}
- return FALSE;
+ return result;
}
/**
const guchar *data,
gint length);
gboolean gtk_selection_data_set_text (GtkSelectionData *selection_data,
- const guchar *str);
+ const gchar *str,
+ gint len);
guchar * gtk_selection_data_get_text (GtkSelectionData *selection_data);
gboolean gtk_selection_data_get_targets (GtkSelectionData *selection_data,
gchar *str;
str = gtk_text_iter_get_visible_text (&start, &end);
- gtk_selection_data_set_text (selection_data, str);
+ gtk_selection_data_set_text (selection_data, str, -1);
g_free (str);
}
}
gtk_text_buffer_get_bounds (contents, &start, &end);
str = gtk_text_iter_get_visible_text (&start, &end);
- gtk_selection_data_set_text (selection_data, str);
+ gtk_selection_data_set_text (selection_data, str, -1);
g_free (str);
}
}
if (str)
{
- gtk_selection_data_set_text (selection_data, str);
+ gtk_selection_data_set_text (selection_data, str, -1);
g_free (str);
}
}